package com.lframework.starter.web.inner.bo.system.user.group;

import com.lframework.starter.web.core.bo.BaseBo;
import com.lframework.starter.web.core.utils.ApplicationUtil;
import com.lframework.starter.web.inner.entity.SysUserGroup;
import com.lframework.starter.web.inner.service.system.SysUserGroupDetailService;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * <p>
 * 用户组 GetBo
 * </p>
 *
 * @author zmj
 */
@Data
public class GetSysUserGroupBo extends BaseBo<SysUserGroup> {

    /**
     * ID
     */
    @ApiModelProperty("ID")
    private String id;

    /**
     * 编号
     */
    @ApiModelProperty("编号")
    private String code;

    /**
     * 名称
     */
    @ApiModelProperty("名称")
    private String name;

    /**
     * 用户ID
     */
    @ApiModelProperty("用户ID")
    private List<String> userIds;

    /**
     * 备注
     */
    @ApiModelProperty("备注")
    private String description;

    /**
     * 状态
     */
    @ApiModelProperty("状态")
    private Boolean available;

    public GetSysUserGroupBo() {

    }

    public GetSysUserGroupBo(SysUserGroup dto) {

        super(dto);
    }

    @Override
    protected void afterInit(SysUserGroup dto) {

        SysUserGroupDetailService sysUserGroupDetailService = ApplicationUtil.getBean(
                SysUserGroupDetailService.class);
        this.userIds = sysUserGroupDetailService.getUserIdsByGroupId(dto.getId());
    }
}
